/**
 * @author Ramon Loureiro
 * @version March  2011
 */

public class IntercambiadorDatos {
    private int contador ;
    private double TresDistancias[] = new double[4];
    private int indexZona = 3 ;
    private boolean danger ;
    private int power   ;

    public int getPower() {
        return power;
    }

    public void setPower(int power) {
        this.power = power;
    }


    public void setDanger(boolean f){
        danger = f ;
    }
    public boolean getDanger(){
        return danger ;
    }

    public synchronized int getContador() {
        return contador;
    }

    public synchronized void setContador(int contador) {
        this.contador = contador;
    }

    public double getTripleDistancia(int i){
            return this.TresDistancias[i] ;
    }

    public synchronized void setTripleDistance(int f, EyesSensor.ObstacleDetection zona){
        int indexZonaAux = 3 ;
        switch(zona){
                case LEFT  		: indexZonaAux =0 ; break ;
                case CENTER		: indexZonaAux =1 ; break ;
                case RIGHT 		: indexZonaAux =2 ; break ;
                case NO_DETECTION : indexZonaAux =3 ; break ;
        }
        this.indexZona = indexZonaAux ;

        this.TresDistancias[0] = 0 ;
        this.TresDistancias[1] = 0 ;
        this.TresDistancias[2] = 0 ;

        if (indexZonaAux != 3) {
                this.setDanger(true);
                this.TresDistancias[this.indexZona] = f ;
        } else
                this.setDanger(false);

    }

}
